package utility;

/**
 * For DDL operations only. <br>
 */
public abstract class DDLException extends Exception {

	private static final long serialVersionUID = 2L;
	public DDLException() 															{ super(); 					}
	public DDLException(String message) 											{ super(message); 			}	
	public DDLException(String message, Throwable cause) 							{ super(message, cause); 	}	
	public DDLException(Throwable cause) 											{ super(cause); 			}
	
	/**
	 * Occurs when a null value appears when a metadata object was expected
	 */
	public static class DatabaseIntegrityException extends DDLException {
		private static final long serialVersionUID = DDLException.serialVersionUID;
		public DatabaseIntegrityException() 										{ super(); 					}
		public DatabaseIntegrityException(String message) 							{ super(message); 			}	
		public DatabaseIntegrityException(String message, Throwable cause)			{ super(message, cause); 	}	
		public DatabaseIntegrityException(Throwable cause) 							{ super(cause); 			}
	}
	
	/**
	 * Occurs when an metadata object already exists, based on it's name and whatever container(s) that require it to be unique
	 */
	public static class DuplicateEntryException extends DDLException {
		private static final long serialVersionUID = DDLException.serialVersionUID;
		public DuplicateEntryException() 											{ super(); 					}
		public DuplicateEntryException(String message) 								{ super(message); 			}	
		public DuplicateEntryException(String message, Throwable cause) 			{ super(message, cause); 	}	
		public DuplicateEntryException(Throwable cause) 							{ super(cause); 			}
	}
	
	/**
	 * Occurs when calling for a metadata object container does not contain the (by name) requested metadata object 
	 */
	public static class NonExistingEntryException extends DDLException {
		private static final long serialVersionUID = DDLException.serialVersionUID;
		public NonExistingEntryException() 											{ super(); 					}
		public NonExistingEntryException(String message) 							{ super(message); 			}	
		public NonExistingEntryException(String message, Throwable cause)			{ super(message, cause); 	}	
		public NonExistingEntryException(Throwable cause) 							{ super(cause); 			}
	}
	
	/**
	 * Occurs when the name of an metadata object does not meet the requirements
	 */
	public static class NameNotValidException extends DDLException {
		private static final long serialVersionUID = DDLException.serialVersionUID;
		public NameNotValidException() 												{ super(); 					}
		public NameNotValidException(String message) 								{ super(message); 			}	
		public NameNotValidException(String message, Throwable cause)				{ super(message, cause); 	}	
		public NameNotValidException(Throwable cause) 								{ super(cause); 			}
	}
	
	/**
	 * Occurs when an invalid datatype is specified for a column
	 */
	public static class InvalidColumnDatatypeException extends DDLException {
		private static final long serialVersionUID = DDLException.serialVersionUID;
		public InvalidColumnDatatypeException() 									{ super(); 					}
		public InvalidColumnDatatypeException(String message) 						{ super(message); 			}	
		public InvalidColumnDatatypeException(String message, Throwable cause)		{ super(message, cause); 	}	
		public InvalidColumnDatatypeException(Throwable cause) 						{ super(cause); 			}
	}
	
	/**
	 * Occurs when there is an inconsistency within a set of columns
	 */
	public static class InvalidColumnSetException extends DDLException {
		private static final long serialVersionUID = DDLException.serialVersionUID;
		public InvalidColumnSetException() 											{ super(); 					}
		public InvalidColumnSetException(String message) 							{ super(message); 			}	
		public InvalidColumnSetException(String message, Throwable cause)			{ super(message, cause); 	}	
		public InvalidColumnSetException(Throwable cause) 							{ super(cause); 			}
	}
	
	/**
	 * Occurs when there is an issue regarding Primary Key operations specifically
	 */
	public static class PrimaryKeyException extends DDLException {
		private static final long serialVersionUID = DDLException.serialVersionUID;
		public PrimaryKeyException() 												{ super(); 					}
		public PrimaryKeyException(String message) 									{ super(message); 			}	
		public PrimaryKeyException(String message, Throwable cause)					{ super(message, cause); 	}	
		public PrimaryKeyException(Throwable cause) 								{ super(cause); 			}
	}
	
	/**
	 * Occurs when an operation creates no difference from current situation, yet is potentially be dangerous
	 */
	public static class IneffectiveAlterationException extends DDLException {
		private static final long serialVersionUID = DDLException.serialVersionUID;
		public IneffectiveAlterationException() 									{ super(); 					}
		public IneffectiveAlterationException(String message) 						{ super(message); 			}	
		public IneffectiveAlterationException(String message, Throwable cause)		{ super(message, cause); 	}	
		public IneffectiveAlterationException(Throwable cause) 						{ super(cause); 			}
	}
	
	/**
	 * Occurs when dropping a metadata object while a Key is still pointing to that metadata object
	 */
	public static class KeyRestrictionException extends DDLException {
		private static final long serialVersionUID = DDLException.serialVersionUID;
		public KeyRestrictionException() 											{ super(); 					}
		public KeyRestrictionException(String message) 								{ super(message); 			}	
		public KeyRestrictionException(String message, Throwable cause)				{ super(message, cause); 	}	
		public KeyRestrictionException(Throwable cause) 							{ super(cause); 			}
	}
	
	/**
	 * Occurs when dropping a metadata object while a Foreign Key is still pointing to that metadata object
	 */
	public static class ForeignKeyRestrictionException extends DDLException {
		private static final long serialVersionUID = DDLException.serialVersionUID;
		public ForeignKeyRestrictionException() 									{ super(); 					}
		public ForeignKeyRestrictionException(String message) 						{ super(message); 			}	
		public ForeignKeyRestrictionException(String message, Throwable cause)		{ super(message, cause); 	}	
		public ForeignKeyRestrictionException(Throwable cause) 						{ super(cause); 			}
	}
}
